package com.example.cato_api.controller;

import com.example.cato_entity.entity.Ingredient;
import org.springframework.hateoas.server.mvc.RepresentationModelAssemblerSupport;

/*
   为每个taco建立一个self链接
 */
public class IngredientEntityModelAssembler extends RepresentationModelAssemblerSupport<Ingredient, IngredientEntityModel> {


    public IngredientEntityModelAssembler() {
        super(IngredientController.class, IngredientEntityModel.class);
    }

    @Override
    public IngredientEntityModel toModel(Ingredient entity) {
        return createModelWithId(entity.getId(), entity);
    }


    @Override
    protected IngredientEntityModel instantiateModel(Ingredient entity) {
        return new IngredientEntityModel(entity);
    }
}
